﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace Sharp.Platform.Mvc
{
    public class CustomPrincipal : IPrincipal
    {
        private CustomIdentity _identity;

        public CustomPrincipal(CustomIdentity identity)
        {
            this._identity = identity;
        }

        public IIdentity Identity
        {
            get
            {
                return _identity;
            }
        }

        public bool IsInRole(string role)
        {
            return false;
        }
        /// <summary>
        /// 登录票据
        /// </summary>
        public string Ticket
        {
            get
            {
                var ticket = System.Web.HttpContext.Current.Request.Cookies["__Ticket"];

                return ticket?.Value;
            }
        }
    }
}
